﻿using UnityEngine;
using System.Collections;

public class ValuableSpawnerScript : ObjectSpawner {

	public GameObject valuablePrefab;
	public GUIStyle textStyle;
	string InstructionText = "Catch the {0}";
	public float ValuableSpawnFrequency;
	public int valuablesToSpawn;

	// Use this for initialization
	new void Start () {
		base.Start ();
		SetUp (ValuableSpawnFrequency, valuablePrefab, this.transform.Find("_Valuables"));
		InstructionText = string.Format (InstructionText, "valuables");
		DisplayInstructions(InstructionText, 3, textStyle);

	}
	Vector3 RandomPosition()
	{
		Vector3 pos = getRandomPositionOnScreen();
		pos.y += 10;
		return pos;
	}
	// Update is called once per frame
	new void Update () {
		if (valuablesToSpawn > 0) {
						if (SpawnerAtPos (RandomPosition ())) {
								valuablesToSpawn--;
						}
				}
		base.Update ();
	}
}
